﻿using System;
using System.Linq.Expressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using élénkPróbája.native;
using élénkPróbája.Test.dto;
using élénkPróbája.Test.extention;

namespace élénkPróbája.Test
{
    [TestClass]
    public class ExtensionTester
    {
        [TestMethod]
        public void TestMethod1()
        {
        }
        [TestMethod]
        public void Should_extract_member_from_member_expression()
        {
            Expression<Func<Company, string>> expression = company => company.Name;
            var member = expression.GetMember();
            member.Name.ShouldEqual("Name");
        }

        [TestMethod]
        public void Should_return_null_for_non_member_expressions()
        {
            Expression<Func<Company, string>> expression = company => "Foo";
            expression.GetMember().ShouldBeNull();
        }

        [TestMethod]
        public void Should_split_pascal_cased_member_name()
        {
            string name = "DateOfBirth".SplitPascalCase();
            name.ShouldEqual("Date Of Birth");
        }

        [TestMethod]
        public void SplitPascalCase_should_return_null_when_input_is_null()
        {
            Extensions.SplitPascalCase(null).ShouldBeNull();
        }
    }
}
